raar.process.sensor
Class RASensor

java.lang.Object
  extended byraar.process.RAProcess
      extended byraar.process.sensor.RASensor
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
RACompass, RAExternalSensor, RARegionSensor

public abstract class RASensor
extends RAProcess
implements java.io.Serializable

RASensor defines the sensors of an agent.

See Also:
Serialized Form

Field Summary
 java.util.Vector emulateRegisterNames
          DO NOT CHANGE; PUBLIC DUE TO JAVA COMPILER BUG.
 java.util.Vector emulateRegisterObjects
          DO NOT CHANGE; PUBLIC DUE TO JAVA COMPILER BUG.
 RADataType output
          DO NOT CHANGE; PUBLIC DUE TO JAVA COMPILER BUG.
 java.lang.String outputName
          DO NOT CHANGE; PUBLIC DUE TO JAVA COMPILER BUG.
 
Fields inherited from class raar.process.RAProcess
hasRun, inregister, outregister, register, sourceCode, statement
 
Constructor Summary
RASensor(java.lang.String outputName, RADataType outputType, RAAgent agent)
          Constructor.
 
Method Summary
 boolean acceptsInput(RADataType b, java.lang.String n)
          The sensor accepts no input at all.
 void dumpRegisters()
          Give a System.out dump of the current content.
 void execute()
          Executing the sensor is illegal and will produce an error.
abstract  java.lang.String explain()
          Give a String that explains what the sensor does.
 RADataType get(java.lang.String key)
          Get a specific key's value from the output register.
 RAAgent getAgent()
          Get sensor's agent.
 java.awt.Color getColor()
          Colour representation.
 RADataType getDataType(java.lang.String name)
          Returns the datatype for a given name.
 java.util.Vector getInputNames()
          A sensor does not have any inputs and will return null.
 java.util.Vector getInputObjects()
          A sensor does not have any inputs and will return null.
 java.util.Vector getOutputNames()
          Get a String vector containing the names of the keys the output register stores (in order).
 java.util.Vector getOutputObjects()
          Get an RADataType vector containing the current content of the output register.
 RADataType getSensorValue()
          Returns the RADataType currently stored in the sensor.
 boolean isSpecial()
          The sensor is a special process and will return true.
abstract  void run()
          Run the sensor (abstract).
 void set(java.lang.String key, RADataType value)
          Setting values from the outside is illegal and will produce an error.
 void setAgent(RAAgent a)
          Set sensor's agent.
protected  void setOutput()
          Recreate the output registers.
 void setSourceCode(java.lang.String code)
          Setting the process source code is illegal and will produce an error.
 boolean suppliesOutput(RADataType b, java.lang.String n)
          See whether the sensor supplies a certain output.
abstract  java.lang.String toString()
          String representation.
 
Methods inherited from class raar.process.RAProcess
clone, getProcessName, getSourceCode, reset, setProcessName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

outputName

public java.lang.String outputName
DO NOT CHANGE; PUBLIC DUE TO JAVA COMPILER BUG.


output

public RADataType output
DO NOT CHANGE; PUBLIC DUE TO JAVA COMPILER BUG.


emulateRegisterNames

public java.util.Vector emulateRegisterNames
DO NOT CHANGE; PUBLIC DUE TO JAVA COMPILER BUG.


emulateRegisterObjects

public java.util.Vector emulateRegisterObjects
DO NOT CHANGE; PUBLIC DUE TO JAVA COMPILER BUG.

Constructor Detail

RASensor

public RASensor(java.lang.String outputName,
                RADataType outputType,
                RAAgent agent)
Constructor.

Method Detail

setSourceCode

public void setSourceCode(java.lang.String code)
                   throws RAException
Setting the process source code is illegal and will produce an error.

Overrides:
setSourceCode in class RAProcess
Throws:
RAException

execute

public void execute()
             throws RAException
Executing the sensor is illegal and will produce an error.

Overrides:
execute in class RAProcess
Throws:
RAException

run

public abstract void run()
                  throws RAException
Run the sensor (abstract).

Overrides:
run in class RAProcess
Throws:
RAException

dumpRegisters

public void dumpRegisters()
Give a System.out dump of the current content.

Overrides:
dumpRegisters in class RAProcess

set

public void set(java.lang.String key,
                RADataType value)
         throws RAException
Setting values from the outside is illegal and will produce an error.

Overrides:
set in class RAProcess
Throws:
RAException

get

public RADataType get(java.lang.String key)
               throws RAException
Get a specific key's value from the output register. Overridden; does work when you use the output name as your key. Will throw an exception otherwise (just as the normal processes).

Overrides:
get in class RAProcess
Throws:
RAException

getDataType

public RADataType getDataType(java.lang.String name)
                       throws RAException
Returns the datatype for a given name. Necessary for making healthy connections. The output of the sensor is no fixed type, so a (general) RADataType is returned.

Overrides:
getDataType in class RAProcess
Throws:
RAException

getOutputNames

public java.util.Vector getOutputNames()
Get a String vector containing the names of the keys the output register stores (in order). This shows a user which outputs a process has (by name).

Overrides:
getOutputNames in class RAProcess

getOutputObjects

public java.util.Vector getOutputObjects()
Get an RADataType vector containing the current content of the output register. Rather than manipulating this content in a sneaky way now, you should use this feature to determine the datatypes of the content. This enables checking whether certain connections are allowed between (various) processes' out- and input.

Overrides:
getOutputObjects in class RAProcess

getInputNames

public java.util.Vector getInputNames()
A sensor does not have any inputs and will return null.

Overrides:
getInputNames in class RAProcess

getInputObjects

public java.util.Vector getInputObjects()
A sensor does not have any inputs and will return null.

Overrides:
getInputObjects in class RAProcess

getSensorValue

public RADataType getSensorValue()
Returns the RADataType currently stored in the sensor.


isSpecial

public boolean isSpecial()
The sensor is a special process and will return true.

Overrides:
isSpecial in class RAProcess

setOutput

protected void setOutput()
Recreate the output registers.


setAgent

public void setAgent(RAAgent a)
Set sensor's agent.


getAgent

public RAAgent getAgent()
Get sensor's agent.


acceptsInput

public boolean acceptsInput(RADataType b,
                            java.lang.String n)
The sensor accepts no input at all.

Overrides:
acceptsInput in class RAProcess

suppliesOutput

public boolean suppliesOutput(RADataType b,
                              java.lang.String n)
See whether the sensor supplies a certain output.

Overrides:
suppliesOutput in class RAProcess

toString

public abstract java.lang.String toString()
String representation.


explain

public abstract java.lang.String explain()
Give a String that explains what the sensor does.


getColor

public java.awt.Color getColor()
Colour representation.